package com.wsl.aop.pattern;

/**
 * @author ：wangshuliang
 * @date ：Created in 2019/6/5 7:53
 * @description：代理对象   代理对象进行一些边沿的操作
 * @modified By：
 */
public class Proxy implements Subject {
    private RealSubject realSubject;

    public Proxy(RealSubject realSubject) {
        this.realSubject = realSubject;
    }

    @Override
    public void request() {
        System.out.println("before");
        try{
            realSubject.request();
        }catch (Exception e){
            System.out.println("ex:"+e.getMessage());
            throw  e;
        }finally {
            System.out.println("after");
        }


    }

    @Override
    public void hello() {

    }
}
